//
//  AppDelegate.swift
//  SkylowAPP
//
//  Created by 王王凤丽 on 2024/9/20.
//

import UIKit
import CYLTabBarController

@main
class AppDelegate: UIResponder, UIApplicationDelegate,UITabBarControllerDelegate {

    var window: UIWindow?

    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
        // Override point for customization after application launch.
        
        CYLPlusButtonSubclass.register()
        
        let mainTabBarVc = MainTabBarController(viewControllers: viewControllers(), tabBarItemsAttributes: tabBarItemsAttributesForController())
        window = UIWindow()
        window?.frame = UIScreen.main.bounds
        window?.rootViewController = mainTabBarVc
        mainTabBarVc.hideTabBadgeBackgroundSeparator()
        mainTabBarVc.hideTabBarShadowImageView();
        window?.makeKeyAndVisible()
        UITabBar.appearance().backgroundColor = UIColor.black
        UITabBar.appearance().barTintColor = UIColor.black
        return true
    }

    
    func viewControllers() -> [UINavigationController] {
        let home = SWNavigationController(rootViewController: HomeViewController())
        let character = SWNavigationController(rootViewController: CharacterViewController())
        let message = SWNavigationController(rootViewController: MessageViewController())
        let personal = SWNavigationController(rootViewController: ProfileViewController())
        let viewControllers = [home, character, message, personal]

        return viewControllers
    }
    
    func tabBarItemsAttributesForController() -> [[String: String]] {
        let tabBarItemOne = [
                             CYLTabBarItemImage: "Tab_Main_Nor",
                             CYLTabBarItemSelectedImage: "Tab_Main_Sel"]

        let tabBarItemTwo = [
                             CYLTabBarItemImage: "Tab_two_Nor",
                             CYLTabBarItemSelectedImage: "Tab_two_Sel"]

        let tabBarItemThree = [
                               CYLTabBarItemImage: "Tab_mes_Nor",
                               CYLTabBarItemSelectedImage: "Tab_mes_Sel"]

        let tabBarItemFour = [
                              CYLTabBarItemImage: "Tab_Mine_Nor",
                              CYLTabBarItemSelectedImage: "Tab_Mine_Sel"]
        let tabBarItemsAttributes = [tabBarItemOne, tabBarItemTwo, tabBarItemThree, tabBarItemFour]
        return tabBarItemsAttributes
    }
    
    
}

